'''
Created on Sep 3, 2010

@author: oabalbin
'''
'''
It process the miRBase mature.fa or precursor.fa files
Extract only sequences related with human miRNAs
'''

def process_file(fastafile, outfasta):
    outfile = open(outfasta,'w')
    flag=False
    for line in fastafile:
        #print line
        if line.startswith('>hsa') and not flag:
            outfile.write(line)
            flag=True
            continue
        
        if flag:
            outfile.write(line)
            flag=False
    
    outfile.close()
            
'''
myfile = open('/data/projects/mirnas/miRBase/hairpin.fa')
outfile = '/data/projects/mirnas/miRBase/hairpin_hsa.fa'
process_file(myfile,outfile)
'''
